import json

from flask import Blueprint, request
from app.Controllers.BaseController import BaseController
from app.Package.entity.PLSDARequestBody import PLSDARequestBody
from app.Service.ChemometricsTutorialsServices.PLSDAService import getPLSDAScorePlot, getPLSDAScreePlot, getPLSDACvPlot, \
    getPLSDAOutlier, \
    getPLSDAPermutationTest, getPLSDAPermutationTestPlot, getOrthogonalPLSDAScorePlot, PLSDACommonProcess, \
    getPLSRScorePlot
from app.Service.ChemometricsTutorialsServices.CommonService import getProjectInfo

plsda = Blueprint('plsda', __name__)


@plsda.route('/')
def index():
    return BaseController().successData(msg="it's PLSDA")


@plsda.route('/getOrthogonalPLSDAScorePlot', methods=['POST'])
def OrthogonalPLSDAScorePlot():
    PLSDA = PLSDACommonProcess()
    result = getOrthogonalPLSDAScorePlot(PLSDA)
    return result


@plsda.route('/getPLSDAScorePlot', methods=['POST'])
def PLSDAScorePlot():
    PLSDA = PLSDACommonProcess()
    result = getPLSDAScorePlot(PLSDA)
    return result


@plsda.route('/getPLSRScorePlot', methods=['POST'])
def PLSRScorePlot():
    PLSDA = PLSDACommonProcess()
    result = getPLSRScorePlot(PLSDA)
    return result


@plsda.route('/getPLSDAScreePlot', methods=['POST'])
def PLSDAScreePlot():
    PLSDA = PLSDACommonProcess()
    result = getPLSDAScreePlot(PLSDA)
    return result


@plsda.route('/getPLSDACvPlot', methods=['POST'])
def PLSDACvPlot():
    PLSDA = PLSDACommonProcess()
    result = getPLSDACvPlot(PLSDA)
    return result


@plsda.route('/getPLSDAOutlier', methods=['POST'])
def PLSDAOutlier():
    PLSDA = PLSDACommonProcess()
    result = getPLSDAOutlier(PLSDA)
    return result


@plsda.route('/getPLSDAPermutationTest', methods=['POST'])
def PLSDAPermutationTest():
    PLSDA = PLSDACommonProcess()
    result = getPLSDAPermutationTest(PLSDA)
    return result


@plsda.route('/getPLSDAPermutationTestPlot', methods=['POST'])
def PLSDAPermutationTestPlot():
    PLSDA = PLSDACommonProcess()
    result = getPLSDAPermutationTestPlot(PLSDA)
    return result
